﻿
@using LERP.Web.App_Start
@using NHibernate.Engine
@using Sharp.Framework
@using Sharp.Framework.Extensions

@model List<LERP.Web.Controllers.SubsidiaryViewModels>
@{
    ViewBag.Title = "签约公司列表";
    Layout = "~/Views/Shared/_Layout.cshtml";
} 
            @if (Model != null && Model.Any())
            {
                <table class="table_list" style="width: 99%;">
                    <tr> 
                        <th>公司名称</th> 
                        <th style="width: 100px;">修改时间</th>
                        <th style="width: 100px;">操作</th>
                    </tr>
                    @foreach (var item in Model)
                    {
                        <tr> 
                            <td  >@item.Name</td>
                            <td>@item.Created.ToString("yyyy年MM月dd日")</td> 
                        <td class="action">    
                            @Html.ActionLinkEx("修改", "Index", "Subsidiary", new {idd = item.Id,name=item.Name}, new {@class = ""}) 
                              
                                @Html.ActionLinkEx("删除", "Delete", "Subsidiary", new {id = item.Id, returnUrl = Request.RawUrl}, new {@class = "delete"})
                             
                            </td>
                        </tr>
                    }


                </table> 
            }
            else
            {
                <div class="empty">
                    签约公司信息为空
                </div>
            }


@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>@(string.IsNullOrEmpty(Request.QueryString["name"])?"添加签约公司":"修改签约公司") </legend>
        <ul class="list_form">
        
            <li> 
                
                  <label for="name">公司名称</label> 
                <input type="text"  class="text-long" data-val="true" data-val-length="公司名称不能超过64个字符" data-val-length-max="64" 
                          data-val-required="公司名称不能为空" id="name" name="name" value="@Request.QueryString["name"]" /> 
               <span class="field-validation-valid" data-valmsg-for="name" data-valmsg-replace="true"></span>
            </li>
            
        </ul>
    </fieldset>
    
    <input type="submit" class="button-submit" value="保存" />
    if(!string.IsNullOrEmpty(Request.QueryString["name"]))
    {
         @Html.ActionLinkEx("添加新公司","Index","Subsidiary",new{},new{})
}
    <br />
    <br />
    <br />
}

@section Scripts {
    <script type="text/javascript">

        $(function () {
            $("a.delete").click(function () {
                return window.confirm("您确认要"+$(this).html()+"当前签约公司么?");

            });

        })

    </script>

}
